package com.somlsis.fragment

import com.base.BaseFragment
import com.clj.fastble.data.BleDevice
import com.somlsis.activity.BasicInfoActivity
import com.somlsis.adapter.DeviceAdapter
import com.somlsis.bean.Device
import com.somlsis.databinding.FragmentBasicInfoDeviceBinding

class BasicInfoDeviceFragment(val listener: BasicInfoActivity.OnBasicInfoNextClickListener):BaseFragment<FragmentBasicInfoDeviceBinding>() {
    private lateinit var deviceAdapter: DeviceAdapter
    override fun getViewBinding(): FragmentBasicInfoDeviceBinding {
        return FragmentBasicInfoDeviceBinding.inflate(layoutInflater)
    }

    override fun createView() {
        context?.let {
            deviceAdapter= DeviceAdapter(it,object :DeviceAdapter.OnDeviceClickListener{


                override fun onItemClick(position: Int, data: Device?) {
                    listener.onDeviceAddOrConnectClick(data)
                }

                override fun onAddViewClick() {
                    listener.onDeviceAddOrConnectClick(null)
                }

            })
            binding.deviceRv.adapter=deviceAdapter
        }

    }

    override fun refreshUI() {
    }
}